﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options;
using QRCodeBluetooth.BUS;
using QRCodeBluetooth.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace QRCodeBluetooth.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class ProjectController : ControllerBase
    {
        private JwtSettings _jwtSettings;
        IHttpContextAccessor _access;
        public ProjectController(IOptions<JwtSettings> jwtSettingsAccesser, IHttpContextAccessor access
        )
        {
            _jwtSettings = jwtSettingsAccesser.Value;
            _access = access;
        }

        [HttpPost]
        [Route("AddProjectInfo")]
        public ResponseMessage AddProjectInfo(ProjectInfo projectInfo)
        {
            ResponseMessage message = new ResponseMessage();
            ProjectBUS projectBUS = new ProjectBUS();
            message = projectBUS.AddProject(projectInfo);

            return message;
        }

        [HttpPost]
        [Route("EditProjectInfo")]
        public ResponseMessage EditProjectInfo(ProjectInfo projectInfo)
        {
            ResponseMessage message = new ResponseMessage();
            ProjectBUS projectBUS = new ProjectBUS();
            message = projectBUS.EditProject(projectInfo);
            return message;
        }

        [HttpPost]
        [Route("QueryProjectInfo")]
        public ResponseMessage QueryProjectInfo(ProjectInfo projectInfo)
        {
            ResponseMessage message = new ResponseMessage();
            ProjectBUS projectBUS = new ProjectBUS();
            message = projectBUS.QueryProject(projectInfo);
            return message;
        }

        [HttpPost]
        [Route("DeleteProjectInfo")]
        public ResponseMessage DeleteProjectInfo(ProjectInfo projectInfo)
        {
            ResponseMessage message = new ResponseMessage();
            ProjectBUS projectBUS = new ProjectBUS();
            message = projectBUS.DeleteProject(projectInfo);
            return message;
        }
    }

    
}
